import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/layout/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      hidden: true, // 不显示在左侧菜单
      component: () => import('@/views/login/index.vue')
    },
    // 首页
    {
      path: '/',
      component: Layout,
      redirect: '/dashboard',
      children: [
        {
          path: '/dashboard',
          component: () => import('@/views/dashboard/index.vue'),
          meta: {
            // 路由元信息 专门存储自定义属性的位置
            title: '首页'
            // icon: '<el-icon><House /></el-icon>'
          }
        }
      ]
    },
    // 线索管理
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/clue',
          component: () => import('@/views/clue/index.vue'),
          meta: {
            // 路由元信息 专门存储自定义属性的位置
            title: '线索管理'
            // icon: '<el-icon><House /></el-icon>'
          }
        }
      ]
    },
    // 商机管理
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/business',
          component: () => import('@/views/business/index.vue'),
          meta: {
            // 路由元信息 专门存储自定义属性的位置
            title: '商机管理'
            // icon: '<el-icon><House /></el-icon>'
          }
        }
      ]
    },
    // 合同管理
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/contract',
          component: () => import('@/views/contract/index.vue'),
          meta: {
            // 路由元信息 专门存储自定义属性的位置
            title: '合同管理'
            // icon: '<el-icon><House /></el-icon>'
          }
        }
      ]
    },
    // 课程管理
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/course',
          component: () => import('@/views/course/index.vue'),
          meta: {
            // 路由元信息 专门存储自定义属性的位置
            title: '课程管理'
            // icon: '<el-icon><House /></el-icon>'
          }
        }
      ]
    },
    // 活动管理
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/activity',
          component: () => import('@/views/activity/index.vue'),
          meta: {
            // 路由元信息 专门存储自定义属性的位置
            title: '活动管理'
            // icon: '<el-icon><House /></el-icon>'
          }
        }
      ]
    },
    // 工单管理
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/workorder',
          component: () => import('@/views/workOrder/index.vue'),
          meta: {
            // 路由元信息 专门存储自定义属性的位置
            title: '工单管理'
            // icon: '<el-icon><House /></el-icon>'
          }
        }
      ]
    },
    // 统计分析
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/analyse',
          component: () => import('@/views/analsyse/index.vue'),
          meta: {
            // 路由元信息 专门存储自定义属性的位置
            title: '统计分析'
            // icon: '<el-icon><House /></el-icon>'
          }
        }
      ]
    },
    // 系统管理
    {
      path: '/system',
      component: Layout,
      meta: {
        title: '系统管理'
      },
      children: [
        {
          path: '/system/notice',
          component: () => import('@/views/system/notice.vue'),
          meta: {
            title: '通知中心'
          }
        },
        {
          path: '/system/limit',
          redirect: '/system/limit',
          meta: {
            title: '权限管理'
          },
          children: [
            {
              path: '/system/limit/user',
              component: () => import('@/views/system/limit/user.vue'),
              meta: {
                title: '用户管理'
              }
            },
            {
              path: '/system/limit/role',
              component: () => import('@/views/system/limit/role.vue'),
              meta: {
                title: '角色管理'
              }
            },
            {
              path: '/system/limit/menu',
              component: () => import('@/views/system/limit/menu.vue'),
              meta: {
                title: '菜单管理'
              }
            },
            {
              path: '/system/limit/department',
              component: () => import('@/views/system/limit/department.vue'),
              meta: {
                title: '部门管理'
              }
            },
            {
              path: '/system/limit/station',
              component: () => import('@/views/system/limit/station.vue'),
              meta: {
                title: '岗位管理'
              }
            }
          ]
        },
        {
          path: '/system/dictionary',
          component: () => import('@/views/system/dictionary.vue'),
          meta: {
            title: '字典管理'
          }
        },
        {
          path: '/system/log',
          component: () => import('@/views/system/log.vue'),
          meta: {
            title: '日志管理'
          }
        }
      ]
    }
  ]
})

export default router
